package com.server.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.server.mapper.UserMapper;
import com.server.entity.User;
import com.server.service.UserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * (UserMsg)表服务实现类
 *
 * @author wzw
 * @since 2024-07-30 12:00:38
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
    @Autowired
    UserMapper userMapper;

    @Override
    public List<User> findUser(String password,String nickname) {
        QueryWrapper<User> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("password",password).eq("nickname",nickname);
        return userMapper.selectList(queryWrapper);
    }

    @Override
    public User login(User user) {
        QueryWrapper<User> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("password",user.getPassword()).eq("nickname",user.getNickname());
        return userMapper.selectOne(queryWrapper);
    }
}


